package com.xyy.saas.payment.adpater.yzh.vo;

import com.xyy.saas.payment.adpater.yzh.BasePay;
import com.xyy.saas.payment.adpater.yzh.constant.ConfigPath;
import com.xyy.saas.payment.util.AmountCastUtil;
import com.xyy.saas.payment.util.ApolloUtil;
import com.xyy.saas.payment.util.JSONUtils;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;


/**
 * 银行卡实时下单
 */
@Slf4j
@Data
public class BankCardOrder extends BasePay<BankCardOrderRequest> {

    @Override
    public BankCardOrderRequest assembleParam() {
        BankCardOrderRequest request = BankCardOrderRequest.builder()
                .order_id(bizNo)
                .dealer_id(ApolloUtil.getProperty(ConfigPath.YZH_DEALERID))
                .broker_id(ApolloUtil.getProperty(ConfigPath.YZH_BROKERID))
                .real_name(realName)
                .card_no(bankcardNo)
                .id_card(idCard)
                .pay(AmountCastUtil.castFen2Yuan(amount))
                .pay_remark(mark)
                .notify_url(ApolloUtil.getProperty(ConfigPath.BANK_CARD_PAY_RESULT_NOTIFY_URL))
                .build();
        log.info("BankCardOrderRequest#assembleParam:{}", JSONUtils.toJSON(request));
        return request;
    }

    /**
     * 业务单号
     */
    private String bizNo;
    /**
     * 真实姓名
     */
    private String realName;
    /**
     * 银行卡号
     */
    private String bankcardNo;
    /**
     * 身份证号
     */
    private String idCard;
    /**
     * 手机号
     */
    private String mobile;
    /**
     * 金额 分
     */
    private long amount;
    /**
     * 备注，最长20字符，不能有特殊字符
     */
    private String mark;

    public BankCardOrder() {
    }

    public BankCardOrder(String bizNo, String realName, String bankcardNo, String idCard, String mobile, long amount, String mark) {
        this.bizNo = bizNo;
        this.realName = realName;
        this.bankcardNo = bankcardNo;
        this.idCard = idCard;
        this.mobile = mobile;
        this.amount = amount;
        this.mark = mark;
    }
}
